/*
 * @Date: 2022-04-06 10:52:16
 * @LastEditors: LiuPeng
 * @LastEditTime: 2022-04-11 17:15:49
 * @FilePath: \pay\src\API\index.js
 * @Description: 
 * 
 */
import axios from './../util/axios'

// 登录接口 
export const loginRequest = (data) => {
  return axios(
    {
      url: 'dfxt/login',
      method: 'post',
      params: data
    }
  ).catch(err => {
    console.log('---err---', err);
  })
}
// 退出登录接口 
export const loginOut = (data) => {
  return axios(
    {
      url: 'dfxt/logout',
      method: 'post',
      params: data,
      headers: {
        Authorization: localStorage.getItem('token')
      }
    }
  ).catch(err => {
    console.log('---err---', err);
  })
}

// 查询所有代付订单接口
export const getPaymentOrder = (data) => {
  return axios({
    url: 'admin/df_dingDan/selectAllDaiFuDingDan',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

// 查询所有用户列表(商户)
export const allMerchantList = () => {
  return axios({
    url: 'admin/df_dingDan/selectAllShangHu',
    method: 'get',
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

// 查询所有订单状态列表
export const allOrderStatus = () => {
  return axios({
    url: 'admin/df_dingDan/selectAllZhuangTai',
    method: 'get',
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

// 查询指定代付订单接口(搜索)
export const conditionQueryPaymentOrder = (data) => {
  return axios({
    url: 'admin/df_dingDan/selectDaiFuDingDanByCondition',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

//查看代付订单(详细)
export const viewPaymentOrderDetailed = (data) => {
  return axios({
    url: 'admin/df_dingDan/selectDaiFuDingDanById',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}


//  代付配置所用接口

// 查询所有商户信息接口
export const allMerchantInformation = (data) => {
  return axios({
    url: 'admin/sh_peiZhi/selectAllShangHu',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

// 查询点击商户的已有支付配置数据
export const paymentConfigurationData = (data) => {
  return axios({
    url: 'admin/sh_peiZhi/selectAllFeiLvConfig',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

// 修改商户代付配置数据
export const modifyMerchantPayment = (data) => {
  return axios({
    url: 'admin/sh_peiZhi/updFeiLvConfig',
    method: 'post',
    data: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}
// 添加商户代付配置数据
export const addMerchantPayment = (data) => {
  return axios({
    url: 'admin/sh_peiZhi/addFeiLvConfig',
    method: 'post',
    data: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}
//删除商户代付配置数据
export const deleteMerchantPayment = (data) => {
  // console.log(data);
  return axios({
    url: 'admin/sh_peiZhi/delFeiLvConfig',
    method: 'post',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}
//查询指定商户数据
export const queryMerchant = (data) => {
  // console.log(data);
  return axios({
    url: 'admin/sh_peiZhi/selectByCondition',
    method: 'get',
    params: data,
    headers: {
      Authorization: localStorage.getItem('token')
    }
  }).catch(err => {
    console.log('---err---', err);
  })
}

